var express = require('express');
var router = express.Router();

const { getUserInfo, modifyUsers, collection, getCollection, wxLogin, browse, getBrowse } = require('../service/usersService')

// 获取用户信息
router.post('/getUserInfo', async (req, res) => {
    const data = await getUserInfo(req.body)
    res.send(data)
});

// 修改用户信息
router.post('/modifyUsers', async (req, res) => {
    const data = await modifyUsers(req.body)
    res.send(data)
});

// 收藏和取消收藏
router.post('/collection', async (req, res) => {
    const data = await collection(req.body)
    res.send(data)
});

// 获取收藏
router.post('/getCollection', async (req, res) => {
    const data = await getCollection(req.body)
    res.send(data)
});

// 浏览商品
router.post('/browse', async (req, res) => {
    const data = await browse(req.body)
    res.send(data)
});

// 获取浏览商品
router.post('/getBrowse', async (req, res) => {
    const data = await getBrowse(req.body)
    res.send(data)
});

// 微信授权登录
router.post('/wxLogin', async (req, res) => {
    const data = await wxLogin(req.body)
    res.send(data)
});

module.exports = router;
